<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateWorkOrderUserRoleTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('work_order_user_role', function (Blueprint $table) {
            $table->id();
            $table->string('name', 32)->default('')->comment('姓名');
            $table->string('feishuId', 16)->default('')->comment('飞书用户主键');
            $table->string('mobile', 20)->default('')->comment('手机号');
            $table->tinyInteger('role')->default(0)->comment('用户角色 0-默认 1-客服 2-品控 3-仓配 4-产品 5-管理员 枚举控制');
            $table->integer('userId')->default(0)->comment('RMS用户ID');
            $table->unsignedInteger('isDeleted')->default(0)->comment('是否删除 0 - 正常 1 - 已删除');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->collation = 'utf8mb4_general_ci';
            $table->index(['role'], 'idx_role');
            $table->comment = '工单用户角色列表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('work_order_user_role');
    }
}
